package nz.co.doherty.gwtpbreadcrumbs.client.ui.customers;

import nz.co.doherty.gwtpbreadcrumbs.client.i8n.ClientConstants;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.philbeaudoin.gwtp.mvp.client.ViewImpl;


public class CustomerListItemViewImpl extends ViewImpl implements CustomerListItemView {

	interface Binder extends UiBinder<Widget, CustomerListItemViewImpl> {
	}

	private static Binder binder = GWT
			.create(Binder.class);

	final Widget widget;
	
	@UiField
	Label firstName;
	
	@UiField
	Label lastName;
	
	@UiField
	Hyperlink moreInfo;
	
	@Inject
	public CustomerListItemViewImpl(ClientConstants constants) {
		widget = binder.createAndBindUi(this);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}

	@Override
	public void setFirstName(String firstName) {
		this.firstName.setText(firstName);		
	}

	@Override
	public void setLastName(String lastName) {
		this.lastName.setText(lastName);		
	}

	@Override
	public void setToken(String token) {
		this.moreInfo.setTargetHistoryToken(token);		
	}

}
